<?php
/**
 * Created by PhpStorm.
 * User: Yui
 * Date: 2017/5/11 0011
 * Time: 19:43
 */

namespace common\library;


class htmlHelper
{
    /**
     * html判断数组中的值是否存在且等于
     * @param array $arr
     * @param string $valueName
     * @param $equalVal
     * @param string $echoStr
     */
    public static function issetAndEqual($arr, $valueName, $compareVal, $echoStr)
    {
        if (isset($arr[$valueName]) && $arr[$valueName] == $compareVal) {
            echo $echoStr;
        }
    }

    /**
     * html判断数组中的值是否不存在且等于
     * @param array $arr
     * @param string $valueName
     * @param $compareVal
     * @param string $echoStr
     */
    public static function unsetOrEqual($arr, $valueName, $compareVal, $echoStr)
    {
        if (!isset($arr[$valueName]) || $arr[$valueName] == $compareVal) {
            echo $echoStr;
        }
    }
}